<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="wangyuguo">
		<title>选择角色</title>
		<script type="text/javascript" language="JavaScript" src="../script/common.js"></script>
		<script type="text/javascript" language="JavaScript" src="../script/tree.js"></script>
		<script type="text/javascript" language="JavaScript">
			var qt = null;
			var tree = null;
			var groupId = null;
			
			function load() {
				setPages(["listview","detview"]);
				parent.dialog.goBack = goBack;
				showBtnBar(true);
				createTable();
			}
			/**数据列表部分**/
			//生成表格，创建QueryTable对象
			function createTable() {
				var columns = []
				columns[0] = {type:"radio"}
				columns[4] = {title:"功能模块",width:"25",render:function(v, r) {
						return "<a href=# onclick='showRoleDet(" + r[0] + ")'>查看</a>"
					}}
				qt = new QueryTable("sel_role", null, "datalist", columns,{
					title : "角色列表",
					columnsConf:false,
					showData:true,
					paramFunc : function() {
						return {orgLevel:"%_" + getPara("orgLevel") + "_%"};
					}
				});
			}
			
			//数据处理方法
			function showRoleDet(id) {
				showBtnBar(false);
				switchPage("detview");
				SystemMgnt.showGroup("detview",id);
			}
			
			function showBtnBar(b) {
				var html = ''
				if (b) {
					html += '<button type=button onclick="dialog.save();">确 定</button>';
					html += '<button type=button onclick="window.close()">取 消</button>';
				} else {
					html += '<button type=button onclick="dialog.goBack()">返 回</button>';
				}
				parent.dialog.btnBar(html);
			}
			
			function goBack() {
				showBtnBar(true);
				switchPage("listview");
			}
			
			function onSave() {
				var obj = qt.getRadioValue(true);
				if (!obj){
					showWarning("请选择角色！");return;
				}
				var v = {id : obj[0],
					name : obj[1]
				}
				dialogBackValue(v);
			}
		</script>
	</head>
	<body class="body" onload="load()">
		<div id="listview">
			<div id="datalist"></div>
		</div>
		<div id="detview" style="display:none;"></div>
	</body>
</html>
